package com.itheima.dubbo.mysql.impl;

import cn.hutool.core.convert.Convert;
import com.alibaba.dubbo.config.annotation.Service;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.itheima.commons.pojo.domain.SoulQuestion;
import com.itheima.commons.vo.reception.PageResult;
import com.itheima.commons.vo.reception.QuestionsVo;
import com.itheima.dubbo.interfaces.SoulQuestionApi;
import com.itheima.dubbo.mysql.mapper.SoulQuestionMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.PageRequest;

import java.io.Serializable;
import java.util.List;
@Service
public class SoulQuestionApiImpl implements SoulQuestionApi {
    @Autowired
    SoulQuestionMapper soulQuestionMapper;

    @Override
    public SoulQuestion findOneByQueId(Long questionId) {
       return soulQuestionMapper.selectOne(Wrappers.lambdaQuery(SoulQuestion.class)
                .eq(SoulQuestion::getId,questionId));
    }

    @Override
    public List<SoulQuestion> findAllById(Long id) {
      return   soulQuestionMapper.selectList(Wrappers.lambdaQuery(SoulQuestion.class)
                .eq(SoulQuestion::getQuestionnaireId,id)
        );
    }
}
